﻿namespace Beetle
{
    using System;
    using System.Configuration;

    public class ConfigSection : ConfigurationSection
    {
        [ConfigurationProperty("ChannelMaxQueueData", DefaultValue=0)]
        public int ChannelMaxQueueData
        {
            get
            {
                return (int) base["ChannelMaxQueueData"];
            }
            set
            {
                base["ChannelMaxQueueData"] = value;
            }
        }

        [ConfigurationProperty("Connections", DefaultValue=0x3e8), IntegerValidator(MaxValue=0xc350, MinValue=1)]
        public int Connections
        {
            get
            {
                return (int) base["Connections"];
            }
            set
            {
                base["Connections"] = value;
            }
        }

        [ConfigurationProperty("ExecutionContext", DefaultValue=false)]
        public bool ExecutionContext
        {
            get
            {
                return (bool) base["ExecutionContext"];
            }
            set
            {
                base["ExecutionContext"] = value;
            }
        }

        [ConfigurationProperty("PackageMaxSize", DefaultValue=0x2000), IntegerValidator(MaxValue=0x61bcf00, MinValue=0x400)]
        public int PackageMaxSize
        {
            get
            {
                return (int) base["PackageMaxSize"];
            }
            set
            {
                base["PackageMaxSize"] = value;
            }
        }

        [IntegerValidator(MaxValue=100, MinValue=1), ConfigurationProperty("Pools", DefaultValue=1)]
        public int Pools
        {
            get
            {
                return (int) base["Pools"];
            }
            set
            {
                base["Pools"] = value;
            }
        }

        [IntegerValidator(MaxValue=0x9c6180, MinValue=0x400), ConfigurationProperty("ReceiveBufferSize", DefaultValue=0x800)]
        public int ReceiveBufferSize
        {
            get
            {
                return (int) base["ReceiveBufferSize"];
            }
            set
            {
                base["ReceiveBufferSize"] = value;
            }
        }

        [ConfigurationProperty("SendBufferSize", DefaultValue=0x800), IntegerValidator(MaxValue=0x9c6180, MinValue=0x400)]
        public int SendBufferSize
        {
            get
            {
                return (int) base["SendBufferSize"];
            }
            set
            {
                base["SendBufferSize"] = value;
            }
        }

        [ConfigurationProperty("SocketReceiveThreads", DefaultValue=1), IntegerValidator(MaxValue=100, MinValue=0)]
        public int SocketReceiveThreads
        {
            get
            {
                return (int) base["SocketReceiveThreads"];
            }
            set
            {
                base["SocketReceiveThreads"] = value;
            }
        }

        [IntegerValidator(MaxValue=100, MinValue=0), ConfigurationProperty("SocketSendThreads", DefaultValue=1)]
        public int SocketSendThreads
        {
            get
            {
                return (int) base["SocketSendThreads"];
            }
            set
            {
                base["SocketSendThreads"] = value;
            }
        }

        [ConfigurationProperty("SocketThreadSleep", DefaultValue=10), IntegerValidator(MaxValue=0x3e8, MinValue=1)]
        public int SocketThreadSleep
        {
            get
            {
                return (int) base["SocketThreadSleep"];
            }
            set
            {
                base["SocketThreadSleep"] = value;
            }
        }

        [ConfigurationProperty("Statistics", DefaultValue=false)]
        public bool Statistics
        {
            get
            {
                return (bool) base["Statistics"];
            }
            set
            {
                base["Statistics"] = value;
            }
        }

        [IntegerValidator(MaxValue=0x10000, MinValue=1), ConfigurationProperty("StringEncodingSize", DefaultValue=0x200)]
        public int StringEncodingSize
        {
            get
            {
                return (int) base["StringEncodingSize"];
            }
            set
            {
                base["StringEncodingSize"] = value;
            }
        }

        [ConfigurationProperty("TimeOut", DefaultValue=30)]
        public int TimeOut
        {
            get
            {
                return (int) base["TimeOut"];
            }
            set
            {
                base["TimeOut"] = value;
            }
        }

        [ConfigurationProperty("WorkThreads", DefaultValue=1), IntegerValidator(MaxValue=100, MinValue=0)]
        public int WorkThreads
        {
            get
            {
                return (int) base["WorkThreads"];
            }
            set
            {
                base["WorkThreads"] = value;
            }
        }

        [IntegerValidator(MaxValue=0x3e8, MinValue=1), ConfigurationProperty("WorkThreadSleep", DefaultValue=10)]
        public int WorkThreadSleep
        {
            get
            {
                return (int) base["WorkThreadSleep"];
            }
            set
            {
                base["WorkThreadSleep"] = value;
            }
        }
    }
}

